<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
      
    <input type="text" v-myinput>

    <input type="text" v-myinput2='msg' v-global>
  </div>
  <script src="./vue.js"></script>
  <script>
      Vue.directive('global',{
        inserted:function(el) {
                el.style.backgroundColor='red'
            }
      })

    var vm = new Vue({
      el:'#app',
      data:{
          msg: {
              width:'100px',
              height:"100px"
          }
      },
      directives:{
          myinput: {
            inserted:function(el) {
                el.style.backgroundColor='gold'
            }
          },
          myinput2:{
            bind: function(el,binding) {
                console.log('binding');
                el.style.width = binding.value.width;
                el.style.height = binding.value.height;
            }
          }
      }
     });
  </script>
</body>
</html>
